<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />


<table width="100%" align="center">
	<tr  class="t_bar">
		<td align="right" width="20%">申请资助金额合计：</td>
		<td width="80%">
		<input name="proposal/budget_funds" id="budget_funds" class="input_text gray" disabled="disabled"  style="background-color:#d8d8d9; text-align:right" value="<x:out select="$xmlData/data/proposal/budget_funds" />" />万元
		<input name="proposal/budget_funds1" type="hidden" id="budget_funds1"   value="<x:out select="$xmlData/data/proposal/budget_funds1" />" />
		<input name="proposal/budget_funds2"  type="hidden" id="budget_funds2"   value="<x:out select="$xmlData/data/proposal/budget_funds2" />" />
		</td>
	</tr>
</table>

<div class="t_bar">
	<span class="color_red">*</span>已参展情况（金额单位：万元）
</div>
<table id="tblExhibition" cellpadding="0" class="table01" width="100%"
	border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
	<thead>
		<tr style="border: 1px solid #B7D1E6">
			<th class="TblHead" align="center" width="5%">选择</th>
			<th class="TblHead" align="center" width="5%">序号</th>
			<th class="TblHead" align="center" width="15%">参展名称</th>
			<th class="TblHead" align="center" width="15%">展会所在国家/地区</th>
			<th class="TblHead" align="center" width="10%">展览时间</th>
			<th class="TblHead" align="center" width="20%">参展组织单位</th>
			<th class="TblHead" align="center" width="10%">参展展位费</th>
			<th class="TblHead" align="center" width="10%">申请资助金额</th>
			<th class="TblHead" align="center" width="10%">参展效果</th>
		</tr>
	</thead>
	<tbody id="tab">
		<tr style="display: none" align="center">
			<td align="center"><input type="radio" class="radiobutton" name="selExhibition"></td>
			<td align="center"><span name="exhibitions|exhibition[0]@seq_no">[index]</span></td>
			<td align="center"><input type="text" name="exhibitions|exhibition[0]|name"
				label="参展名称" style="width: 80%;" class="required input_text "
				maxlength="50" /></td>
			<td align="center"><input type="text" name="exhibitions|exhibition[0]|country"
				label="展会所在国家/地区" style="width: 80%;" class="required input_text "
				maxlength="50" /></td>
			<td nowrap align="center"><input id="exhibition_grant_date_[0]"
				name="exhibitions|exhibition[0]|grant_date" required
				class="required input_text date" style="width: 60px" label="展览时间" /></td>
			<td align="center"><input type="text" name="exhibitions|exhibition[0]|org_name"
				label="参展组织单位" style="width: 80%;" class="required input_text "
				maxlength="50" /></td>
			<td align="center"><input type="text"
				name="exhibitions|exhibition[0]|zw_budget" label="参展展位费"
				onfocus="InitInput.setNumber(this,7,4,2)"
				style="text-align: right; width: 80%;" class="required input_text" /></td>
			<td align="center"><input type="text"
				name="exhibitions|exhibition[0]|fund_budget" label="申请资助金额"
				onfocus="InitInput.setNumber(this,7,4,2)" onchange="countTable('tblExhibition','budget_funds1',7);budgetFunds();"
				style="text-align: right; width: 80%;" class="required input_text" /></td>
			<td align="center"><input type="text" name="exhibitions|exhibition[0]|effect"
				label="参展效果" style="width: 80%;" class="required input_text"
				maxlength="50" /></td>

		</tr>

		<c:set value="0" var="index" scope="page" />
		<x:forEach select="$xmlData/data/exhibitions /exhibition"
			var="exhibition">

			<c:choose>
				<c:when test="${index<10}">
					<c:set value="0" var="flag" scope="page" />
				</c:when>
				<c:otherwise>
					<c:set value="" var="flag" scope="page" />
				</c:otherwise>
			</c:choose>
			<tr align="center">
				<td align="center"><input type="radio" class="radiobutton" name="selExhibition"></td>
				<td align="center"><span
					name="exhibitions/exhibition[${flag}${index}]@seq_no"><x:out
							select="$exhibition/@seq_no" /></span></td>
				<td align="center"><input type="text"
					name="exhibitions/exhibition[${flag}${index}]/name" label="参展名称"
					style="width: 80%;" required class="required input_text "
					value="<x:out select="$exhibition/name" />" maxlength="50" /></td>
				<td align="center"><input type="text"
					name="exhibitions/exhibition[${flag}${index}]/country"
					label="展会所在国家/地区" style="width: 80%;" required
					class="required input_text "
					value="<x:out select="$exhibition/country" />" maxlength="50" /></td>
				<td nowrap align="center"><c:set var="grant_date" scope="page">
						<x:out select="$exhibition/grant_date" />
					</c:set> <input id="exhibition_grant_date_[${flag}${index}]"
					value="${grant_date}" label="展览时间"
					name="exhibitions/exhibition[${flag}${index}]/grant_date" required
					class="required date input_text" style="width: 60px" /></td>
				<td align="center"><input type="text"
					name="exhibitions/exhibition[${flag}${index}]/org_name"
					label="参展组织单位" style="width: 80%;" required
					class="required input_text "
					value="<x:out select="$exhibition/org_name" />" maxlength="50" /></td>
				<td align="center"><input type="text"
					name="exhibitions/exhibition[${flag}${index}]/zw_budget"
					label="参展展位费" onfocus="InitInput.setNumber(this,7,4,2)"
					style="text-align: right; width: 80%;" required
					class="required input_text"
					value="<x:out select="$exhibition/zw_budget" />" /></td>
				<td align="center"><input type="text"
					name="exhibitions/exhibition[${flag}${index}]/fund_budget"
					label="申请资助金额" onfocus="InitInput.setNumber(this,7,4,2)"
					style="text-align: right; width: 80%;" required
					class="required input_text" onchange="countTable('tblExhibition','budget_funds1',7);budgetFunds();"
					value="<x:out select="$exhibition/fund_budget" />" /></td>
				<td align="center"><input type="text"
					name="exhibitions/exhibition[${flag}${index}]/effect" label="参展效果"
					maxlength="50" style="width: 80%;" required
					class="required input_text"
					value="<x:out select="$exhibition/effect" />" /></td>
			</tr>
			<c:set value="${index+1}" var="index" scope="page" />
		</x:forEach>
		<script type="text/javascript">
			showAllDateTag("tblExhibition ");
		</script>
	</tbody>
</table>
<br>

<table width="98%" align="center">
	<tr>
		<td><input class="button" name="cmdAddbefore" type=button
			value="添加"
			onclick="if(checkTabLimit('tblExhibition',10,'已参展情况最多只能填写10条')){addNewRow('tblExhibition');showDateTag('tblExhibition');}try{top.resizeFrame();}catch(e){};">
			<input class="button" name="cmdMovePrev" type=button value="上移"
			onclick="movePrev('tblExhibition','selExhibition')"> <input
			class="button" name="cmdMoveNext" type=button value="下移"
			onclick="moveNext('tblExhibition','selExhibition')"> <input
			class="button" name="cmddel" type=button value="删除"
			onclick="deleteSelectedRow('tblExhibition','已参展情况');countTable('tblExhibition','budget_funds1',7);budgetFunds();"></td>
	</tr>
</table>
<br />

<div class="t_bar">
	<span class="color_red">*</span>学术交流情况（金额单位：万元）
</div>
<table id="tblAcademic" cellpadding="0" class="table01" width="100%"
	border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
	<thead>
		<tr style="border: 1px solid #B7D1E6">
			<th class="TblHead" align="center" width="5%">选择</th>
			<th class="TblHead" align="center" width="5%">序号</th>
			<th class="TblHead" align="center" width="15%">学术交流活动名称</th>
			<th class="TblHead" align="center" width="15%">举办活动地点</th>
			<th class="TblHead" align="center" width="10%">时间</th>
			<th class="TblHead" align="center" width="10%">场地提供单位</th>
			<th class="TblHead" align="center" width="10%">场地租赁费用</th>
			<th class="TblHead" align="center" width="10%">专家差旅费用</th>
			<th class="TblHead" align="center" width="10%">申请资助金额</th>
			<th class="TblHead" align="center" width="10%">学术交流活动效果</th>
		</tr>
	</thead>
	<tbody id="tab">
		<tr style="display: none" align="center">
			<td align="center"><input type="radio" class="radiobutton"
				name="selAcademic"></td>
			<td align="center"><span name="academics|academic[0]@seq_no">[index]</span></td>
			<td align="center"><input type="text" name="academics|academic[0]|cname"
				label="学术交流活动名称" style="width: 80%;" class="required input_text "
				maxlength="50" /></td>
			<td align="center"><input type="text" name="academics|academic[0]|address"
				label="举办活动地点" style="width: 80%;" class="required input_text "
				maxlength="50" /></td>
			<td nowrap align="center"><input id="academics_grant_date_[0]"
				name="academics|academic[0]|grant_date" required
				class="required input_text date" style="width: 60px" label="时间" />
			</td>
			<td align="center"><input type="text" name="academics|academic[0]|org_name"
				label="场地提供单位" onfocus="InitInput.setNumber(this,7,4,2)"
				style="text-align: right; width: 80%;" class="required input_text " /></td>
			<td align="center"><input type="text" name="academics|academic[0]|zl_budget"
				label="场地租赁费用" onfocus="InitInput.setNumber(this,7,4,2)"
				style="text-align: right; width: 80%;" class="required input_text " /></td>
			<td align="center"><input type="text" name="academics|academic[0]|cl_budget"
				label="专家差旅费用" onfocus="InitInput.setNumber(this,7,4,2)"
				style="text-align: right; width: 80%;" class="required input_text " /></td>
			<td align="center"><input type="text" name="academics|academic[0]|fund_budget"
				label="申请资助金额" onfocus="InitInput.setNumber(this,7,4,2)" onchange="countTable('tblAcademic','budget_funds2',8);budgetFunds();"
				style="text-align: right; width: 80%;" class="required input_text " /></td>
			<td align="center"><input type="text" name="academics|academic[0]|effect"
				label="学术交流活动效果" style="width: 80%;" class="required input_text "
				maxlength="50" /></td>
		</tr>


		<c:set value="0" var="index" scope="page" />
		<x:forEach select="$xmlData/data/academics/academic" var="academic">

			<c:choose>
				<c:when test="${index<10}">
					<c:set value="0" var="flag" scope="page" />
				</c:when>
				<c:otherwise>
					<c:set value="" var="flag" scope="page" />
				</c:otherwise>
			</c:choose>
			<tr align="center">
				<td align="center"><input type="radio" class="radiobutton"
					name="selAcademic"></td>
				<td align="center"><span
					name="academics/academic[${flag}${index}]@seq_no"><x:out
							select="$academic/@seq_no" /></span></td>
				<td align="center"><input type="text"
					name="academics/academic[${flag}${index}]/cname" label="学术交流活动名称"
					required style="width: 80%;" class="required input_text "
					value="<x:out select="$academic/cname" />" maxlength="50" /></td>
				<td align="center"><input type="text"
					name="academics/academic[${flag}${index}]/address" label="举办活动地点"
					style="width: 80%;" class="required input_text "
					value="<x:out select="$academic/address" />" maxlength="50" /></td>
				<td nowrap align="center"><c:set var="grant_date" scope="page">
						<x:out select="$academic/grant_date" />
					</c:set> <input id="academics_grant_date_[${flag}${index}]"
					value="${grant_date}" label="时间"
					name="academics/academic[${flag}${index}]/grant_date"
					class="required date input_text" style="width: 60px" />
				<td align="center"><input type="text"
					name="academics/academic[${flag}${index}]/org_name" label="场地提供单位"
					onfocus="InitInput.setNumber(this,7,4,2)"
					style="text-align: right; width: 80%;" class="required input_text "
					value="<x:out select="$academic/org_name" />" /></td>
				<td align="center"><input type="text"
					name="academics/academic[${flag}${index}]/zl_budget" label="场地租赁费用"
					onfocus="InitInput.setNumber(this,7,4,2)"
					style="text-align: right; width: 80%;" class="required input_text "
					value="<x:out select="$academic/zl_budget" />" /></td>
				<td align="center" ><input type="text"
					name="academics/academic[${flag}${index}]/cl_budget" label="专家差旅费用"
					onfocus="InitInput.setNumber(this,7,4,2)"
					style="text-align: right; width: 80%;" class="required input_text "
					value="<x:out select="$academic/cl_budget" />" /></td>
				<td align="center"><input type="text"
					name="academics/academic[${flag}${index}]/fund_budget" onchange="countTable('tblAcademic','budget_funds2',8);budgetFunds();"
					label="申请资助金额" onfocus="InitInput.setNumber(this,7,4,2)"
					style="text-align: right; width: 80%;" class="required input_text "
					value="<x:out select="$academic/fund_budget" />" /></td>
				<td align="center"><input type="text"
					name="academics/academic[${flag}${index}]/effect" label="学术交流活动效果"
					onfocus="InitInput.setNumber(this,7,4,2)"
					style="text-align: right; width: 80%;" class="required input_text "
					value="<x:out select="$academic/effect" />" /></td>

			</tr>
			<c:set value="${index+1}" var="index" scope="page" />
		</x:forEach>
		<script type="text/javascript">
			showAllDateTag("tblAcademic");
		</script>
	</tbody>
</table>
<br>

<table width="98%" align="center">
	<tr>
		<td><input class="button" name="cmdAddbefore" type=button
			value="添加"
			onclick="if(checkTabLimit('tblAcademic',10,'学术交流情况最多只能填写10条')){addNewRow('tblAcademic');showDateTag('tblAcademic');}try{top.resizeFrame();}catch(e){};">
			<input class="button" name="cmdMovePrev" type=button value="上移"
			onclick="movePrev('tblAcademic','selAcademic')"> <input
			class="button" name="cmdMoveNext" type=button value="下移"
			onclick="moveNext('tblAcademic','selAcademic')"> <input
			class="button" name="cmddel" type=button value="删除"
			onclick="deleteSelectedRow('tblAcademic','学术交流情况');countTable('tblAcademic','budget_funds2',8);budgetFunds();"></td>
	</tr>
</table>
<script>
function budgetFunds(){
	var budget_funds1=$("#budget_funds1").val();
	var budget_funds2=$("#budget_funds2").val();
	if (!$.isNumeric(budget_funds1)||budget_funds1=='')
		 budget_funds1= "0";
	if (!$.isNumeric(budget_funds2)||budget_funds2=='')
		 budget_funds2= "0";
    var count = ((parseFloat(budget_funds1)*10000 + parseFloat(budget_funds2)*10000)/10000).toFixed(4);
	 count = formatNumberAuto(count.toString(), 9, 4, 2);// 格式化金额
	   $("#budget_funds").val(count);
	
}
</script>
